﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace SystemDiagramNew.SystemDiagramLegend
{
	public partial class AddLegendNameForm : System.Windows.Forms.Form
	{
		public AddLegendNameForm(List<string> legendNameList)
		{
			this.m_LegendNameList = legendNameList;
			this.InitializeComponent();
		}

		public string LegendName
		{
			get
			{
				return this.tbName.Text;
			}
		}

		private void tbName_Validating(object sender, CancelEventArgs e)
		{
			if (this.m_LegendNameList.FindIndex((string s) => s.CompareTo(this.tbName.Text) == 0) != -1)
			{
				MessageBox.Show("新图例名称已经存在.", "盈建科提示");
				e.Cancel = true;
			}
		}

		private List<string> m_LegendNameList = new List<string>();
	}
}
